package com.cheyunkeji.er.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.InputStream;

/**
 * Created by Michael on 2017/7/23 16:52.
 */

public class BitmapUtils {

    /**
     * 获取图片Bitmap
     * @param context
     * @param resId
     * @return
     */
    public static Bitmap decodeSampledBitmapFromResource(Context context, int resId) {
        BitmapFactory.Options opts = new BitmapFactory.Options();
        opts.inPreferredConfig = Bitmap.Config.ARGB_4444;
        InputStream is = context.getResources().openRawResource(resId);
        return BitmapFactory.decodeStream(is, null, opts);
    }

}
